<style scoped lang='less'>
 .oa-url{
     .ivu-input-wrapper{
         width: 30%;
     }
 }
 h4 {
     color: #464c5b;
     padding-top: 20px;
     padding-bottom: 20px;
 }
 h5, p {
     color: #657180;
 }
</style>
<template>
    <div>
        <h4>设置OA系统Url</h4>
        <Alert show-icon>
            此处设置办公OA系统平台的入口地址。设置完成后需要点击“保存”按钮使修改生效。
        </Alert>
        <Row>
            <Col span="6">
                <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="120">
                    <FormItem label="办公系统Url" prop="value">
                        <i-input v-model="formValidate.url" placeholder="请输入URL"></i-input>
                    </FormItem>
                    <Form-item>
                        <i-button @click="handleSubmit('formValidate')" type="primary">保存</i-button>
                        <!--<i-button type="ghost" style="margin-left: 8px">取消</i-button>-->
                    </Form-item>
                </Form>
            </Col>
        </Row>
    </div>
</template>
<script>
    import apiUtil from '../../assets/utils/api_util';

    export default {
        data() {
            return {
                formValidate: {
                    //添加字段
                    url: '',
                },
                ruleValidate: {
                    url: [
                        {required: true, message: 'url不能为空', trigger: 'blur'}
                    ],
                },
                papertypeArr: [],
                oaUrl: '',
            }

        },
        mounted: function () {
            // this.getDetail();
            this.mockTableData();

        },

        methods: {
            //添加
            handleSubmit(name) {

                let that = this;
                let model = this.$refs[name].model;
                this.$refs[name].validate((valid) => {
                    that.addData(model);
                })
            },
            addData: function (model) {
                let that = this;

                let params = that.$qs.stringify(model);
                this.$Loading.start();

                apiUtil.post(that, apiUtil.urls.SetOASystemLink, params, function (res) {
                    that.$Loading.finish();
                    that.$Notice.open({
                        title: '提示',
                        desc: '修改成功'
                    });
                });
            },
            mockTableData() {
                let that = this;

                let para = {};
                let params = that.$qs.stringify(para);

                this.$Loading.start();

                apiUtil.get(that, apiUtil.urls.GetOASystemLink, para, function (res) {
                    that.$Loading.finish();
                    that.formValidate.url = res.Msg;
                });

            },
            uploadList() {
                let that = this;
                this.imageList = that.$refs.upload ? that.$refs.upload.fileList : [];
            },

        }
    }
</script>
